========================================
DIGITAL-IP ACCESS CONTROL SYSTEM
Installation Guide
========================================

Author: Digital Gold
Company: DigitalGold Web Studio
License: Proprietary

========================================
📦 OVERVIEW
========================================

This system allows you to:
- Block or allow users based on IP or country
- Protect your website from unwanted traffic
- Manage access rules dynamically via database

It is designed to work as a plug-and-play module on any PHP website.

----------------------------------------

========================================
⚙️ REQUIREMENTS
========================================

- PHP 7.4 or higher (PHP 8+ recommended)
- MySQL database
- PDO enabled
- Apache / Nginx (no special config required)

----------------------------------------

========================================
📁 INSTALLATION STEPS
========================================

1️⃣ Upload Files

Upload the "restrictor" folder into your project root:

Example:
your-project/
│
├── restrictor/
├── index.php
├── ...

----------------------------------------

2️⃣ Configure Database

Open:
restrictor/config.php

Update your database settings:

'db' => [
    'host' => 'localhost',
    'dbname' => 'your_database',
    'user' => 'your_db_user',
    'pass' => 'your_db_password'
],

----------------------------------------

3️⃣ Activate the System

Open your main entry file (e.g. index.php)

Add this code at the VERY TOP of the file:

<?php
require_once __DIR__ . '/restrictor/bootstrap.php';

$restrictor = new RestrictorBootstrap();
$restrictor->run();

IMPORTANT:
- This must be placed BEFORE any HTML output
- Do NOT place inside header or template files

----------------------------------------

4️⃣ Done ✅

The system will:
- Automatically create required database tables
- Start monitoring visitors immediately

----------------------------------------

========================================
🛠 OPTIONAL CONFIGURATION
========================================

🔹 Use Existing PDO Connection

If your project already uses PDO:

$restrictor = new RestrictorBootstrap($pdo);
$restrictor->run();

----------------------------------------

🔹 Emergency Bypass

Access your site with:

?bypass=YOUR_SECRET_TOKEN

Set your token in:
restrictor/config.php

----------------------------------------

🔹 Admin URL Whitelist

You can define admin paths in the database table:

{prefix}_admin_urls

Example:
/admin
/dashboard

These URLs will bypass restrictions.

----------------------------------------

========================================
⚠️ IMPORTANT NOTES
========================================

- Always include the system BEFORE any output
- Do not modify core files unless necessary
- Ensure your database credentials are correct
- For production, disable error display

----------------------------------------

========================================
🔒 SECURITY TIPS
========================================

- Keep your emergency token private
- Restrict access to your admin URLs
- Regularly monitor blocked traffic
- Use strong database credentials

----------------------------------------

========================================
🧩 TROUBLESHOOTING
========================================

❌ "Database connection error"
→ Check your config.php credentials

❌ "Headers already sent"
→ Ensure the code is at the TOP of your file

❌ System not working
→ Confirm bootstrap is included correctly

----------------------------------------

========================================
📞 SUPPORT
========================================

For support or customization:

DigitalGold Web Studio
🌐 https://digitalgoldwebstudios.com

----------------------------------------

© Digital Gold. All rights reserved.
Unauthorized distribution prohibited.

========================================